<extend name="Layout/page_detail" />
<block name="content">
	{:W('PageHeader/simple',array('name'=>'添加会议:'.$folder_name,'search'=>'N'))}

	<form method='post' id="form_data" name="form_data" enctype="multipart/form-data"  class="well form-horizontal">
		<input type="hidden" id="join_user_id" name="join_user_id" value="{$vo.join_user_id}">
		<input type="hidden" id="join_user_name" name="join_user_name" value="{$vo.join_user_name}">
        <input type="hidden" id="speak_user_id" name="speak_user_id" value="{$vo.speak_user_id}">
        <input type="hidden" id="speak_user_name" name="speak_user_name" value="{$vo.speak_user_name}">
        <input type="hidden" id="holder" name="holder" value="{$vo.holder}">
        <input type="hidden" id="holder_id" name="holder_id" value="{$vo.holder_id}">
		<input type="hidden" id="ajax" name="ajax" value="0">
		<input type="hidden" id="opmode" name="opmode" value="add">

        <div class="form-group">
            <label class="col-sm-2 control-label" for="meet_no">会议编号*：</label>
            <div class="col-sm-10">
                <input type="text" id="meet_no" name="meet_no" value="{:rand_string()}" class="form-control"  check="require" msg="请输入编号">
            </div>
        </div>
		<div class="form-group">
			<label class="col-sm-2 control-label" for="meet_name">会议名称*：</label>
			<div class="col-sm-10">
				<input type="text" id="meet_name" name="meet_name" value="{$vo.meet_name}" class="form-control"  check="require" msg="请输入标题">
			</div>
		</div>
        <div class="form-group col-sm-6">
            <label class="col-sm-4 control-label" for="start_time">开始时间*：</label>
            <div class="col-sm-8">
                <input type="text" id="start_time" name="start_time" readonly="readonly" class="form-control input-date-time" check="require" msg="请输入开始日期">
            </div>
        </div>

        <div class="form-group col-sm-6">
            <label class="col-sm-4 control-label" for="end_time">结束时间*：</label>
            <div class="col-sm-8">
                <input type="text" id="end_time" name="end_time" readonly="readonly"
                       class="form-control input-date-time" check="require" msg="请输入结束日期">
            </div>
        </div>
        <div class="form-group col-sm-6">
            <label class="col-sm-4 control-label" for="location">主持人*：</label>
            <div class="col-sm-8">
                <div id="single_user" class="inputbox">
                    <a class="pull-right btn btn-link text-center" onclick="select_holder();"><i class="fa fa-user"></i> </a>
                    <div class="wrap" >
                        <span class="address_list"></span>
						<span class="text" >
							<input class="letter" type="text"  >
						</span>
                    </div>
                    <div class="search dropdown ">
                        <ul class="dropdown-menu"></ul>
                    </div>
                </div>
            </div>
        </div>
        <div class="form-group col-sm-6">
            <label class="col-sm-4 control-label" for="meet_type_id">会议类型*：</label>
            <div class="col-sm-8">
                <select name="meet_type_id" id="meet_type_id" class="form-control" msg="请选择类型" check="require">
                    <option value="">选择类型</option>
                    {:fill_option($meet_type_list)}
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label" for="location">演讲人员：</label>
            <div class="col-sm-10">
                <div id="speak_actor_wrap" class="inputbox">
                    <a class="pull-right btn btn-link text-center" onclick="select_speak();"><i class="fa fa-user"></i> </a>
                    <div class="wrap" >
                        <span class="address_list"></span>
						<span class="text" >
							<input class="letter" type="text"  >
						</span>
                    </div>
                    <div class="search dropdown ">
                        <ul class="dropdown-menu"></ul>
                    </div>
                </div>
            </div>
        </div>
		<div class="form-group">
			<label class="col-sm-2 control-label" for="location">听众人员：</label>
			<div class="col-sm-10">
				<div id="actor_wrap" class="inputbox">
					<a class="pull-right btn btn-link text-center" onclick="select_join();"><i class="fa fa-user"></i> </a>
					<div class="wrap" >
						<span class="address_list"></span>
						<span class="text" >
							<input class="letter" type="text"  >
						</span>
					</div>
					<div class="search dropdown ">
						<ul class="dropdown-menu"></ul>
					</div>
				</div>
			</div>
		</div>


		<div class="form-group">
			<div class="col-xs-12">
				<textarea  class="editor" id="content" name="subject" style="width:100%;height:300px;" check="require" msg="请输入内容">{$vo.subject}</textarea>
			</div>
		</div>

		<div class="form-actions">
			<input class="btn btn-sm btn-primary" type="button" value="保存" onclick="save();">
			<input  class="btn btn-sm btn-default" type="button" value="取消" onclick="go_return_url();">
		</div>
	</form>
</block>
<block name="js">
	<script type="text/javascript">
		function select_join() {
			winopen("{:U('Popup/scope')}", 730, 574);
		}

        function select_speak() {
            winopen("{:U('Popup/selectspeak')}", 730, 574);
        }
        function select_holder() {
            winopen("{:U('Popup/selectsingleuser')}", 730, 574);
        }
		function save() {
			window.onbeforeunload = null;
			$("#join_user_name").val("");
			$("#actor_wrap span.address_list span").each(function() {
				$("#join_user_name").val($("#join_user_name").val() + $(this).text().replace(';', '') + '|' + $(this).attr("data") + ";");
			});

			$("#join_user_id").val("");
			$("#actor_wrap span.address_list span").each(function() {
				$("#join_user_id").val($("#join_user_id").val() + $(this).attr("data") + ",");
			});

            $("#speak_user_name").val("");
            $("#speak_actor_wrap span.address_list span").each(function() {
                $("#speak_user_name").val($("#speak_user_name").val() + $(this).text().replace(';', '') + '|' + $(this).attr("data") + ";");
            });

            $("#speak_user_id").val("");
            $("#speak_actor_wrap span.address_list span").each(function() {
                $("#speak_user_id").val($("#speak_user_id").val() + $(this).attr("data") + ",");
            });

            $("#holder_id").val("");
            $("#single_user span.address_list span").each(function() {
                $("#holder_id").val($(this).attr("data"));
            });
            $("#single_user span.address_list span").each(function() {
                $("#holder").val($(this).text().replace(';', '') );
            });

			if (check_form("form_data")) {
				sendForm("form_data", "{:U('save')}");
			}
		}


		$(document).on("click", ".inputbox .address_list a.del", function() {
			$(this).parent().parent().remove();
		});

        $(document).ready(function() {
            fill_time("start_time");
            fill_time("end_time");
        });
    </script>
</block>